//
//  MSVisitorTableViewController.swift
//  weibo002
//
//  Created by mac on 10/19/15.
//  Copyright © 2015 mac. All rights reserved.
//

import UIKit

class MSVisitorTableViewController: UITableViewController {
    
    var visitorView: MSVisitorView?
    
    private var userLogon = false
    
    override func loadView() {
        userLogon ? viewDidLoad() : setupVisitorView()
       
    }
  
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    private func setupVisitorView(){
        visitorView = MSVisitorView()
        view = visitorView
        visitorView?.signupButton.addTarget(self, action: "signupButtonClick", forControlEvents: UIControlEvents.TouchUpInside)
        visitorView?.loginButton.addTarget(self, action: "loginButtonClick", forControlEvents: UIControlEvents.TouchUpInside)
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "signupButtonClick")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: "loginButtonClick")
    }

}

extension MSVisitorTableViewController{
    func signupButtonClick(){
        print("注册")
    }
    
    func loginButtonClick(){
        print("登录")
    }
}
